using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableBuffDao:DaoBase<TableBuff>
    {
        public override void AddPrimaryIndex(TableBuff model)
        {
            cachePrimary[model.Id.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableBuff.txt";
        }

        protected override TableBuff ParseRowData(string[] rowData)
        {
            TableBuff data = new TableBuff();
			data.Id = rowData [0];
			data.Group = rowData [1];
			data.Name = rowData [2];

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.BuffClass = 0;
            }
            else
            {
                data.BuffClass = int.Parse(rowData[3]);
            }

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.IsDebuff = 0;
            }
            else
            {
                data.IsDebuff = int.Parse(rowData[4]);
            }

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.ShouldCover = 0;
            }
            else
            {
                data.ShouldCover = int.Parse(rowData[5]);
            }

            if (string.IsNullOrEmpty(rowData[6]))
            {
                data.CanBeCleared = 0;
            }
            else
            {
                data.CanBeCleared = int.Parse(rowData[6]);
            }

            if (string.IsNullOrEmpty(rowData[7]))
            {
                data.TotalTime = 0;
            }
            else
            {
                data.TotalTime = double.Parse(rowData[7]);
            }

            if (string.IsNullOrEmpty(rowData[8]))
            {
                data.TotalRound = 0;
            }
            else
            {
                data.TotalRound = int.Parse(rowData[8]);
            }

            if (string.IsNullOrEmpty(rowData[9]))
            {
                data.SpaceRound = 0;
            }
            else
            {
                data.SpaceRound = int.Parse(rowData[9]);
            }

            if (string.IsNullOrEmpty(rowData[10]))
            {
                data.TotalCount = 0;
            }
            else
            {
                data.TotalCount = int.Parse(rowData[10]);
            }

            if (string.IsNullOrEmpty(rowData[11]))
            {
                data.AttCount = 0;
            }
            else
            {
                data.AttCount = int.Parse(rowData[11]);
            }

            if (string.IsNullOrEmpty(rowData[12]))
            {
                data.DefCount = 0;
            }
            else
            {
                data.DefCount = int.Parse(rowData[12]);
            }
			data.Factor = rowData [13];

            if (string.IsNullOrEmpty(rowData[14]))
            {
                data.Args1 = 0;
            }
            else
            {
                data.Args1 = double.Parse(rowData[14]);
            }

            if (string.IsNullOrEmpty(rowData[15]))
            {
                data.Args2 = 0;
            }
            else
            {
                data.Args2 = double.Parse(rowData[15]);
            }

            if (string.IsNullOrEmpty(rowData[16]))
            {
                data.Args3 = 0;
            }
            else
            {
                data.Args3 = double.Parse(rowData[16]);
            }
			data.Param = rowData [17];
			data.EffectOn = rowData [18];
			data.EffectOnBone = rowData [19];
			data.BuffIconName = rowData [20];
			data.EffectOff = rowData [21];
			data.EffectOffBone = rowData [22];
			data.EffectExport = rowData [23];
			data.EffectExportBone = rowData [24];
			data.HitEffect = rowData [25];
			data.HitEffectBone = rowData [26];
			data.LastEffect = rowData [27];
			data.LastEffectBone = rowData [28];

            return data;
        }



    }

}
